package com.xiaof.store.controller;

import com.xiaof.store.entity.District;
import com.xiaof.store.service.IDistrictService;
import com.xiaof.store.util.JsonResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * Created with IntelliJ IDEA.
 *
 * @ProjectName: store
 * @Package: com.xiaof.store.controller
 * @ClassName: DistrictController
 * @Author: xiaof
 * @Description:
 * @Date: 2022/1/7 21:17
 * @Version: 1.0
 */
@RestController
@RequestMapping("districts")
public class DistrictController extends BaseController {
    @Autowired
    private IDistrictService districtService;
    @GetMapping({"", "/"})
    public JsonResult<List<District>> getByParent(String parent){
        List<District> data = districtService.getByParent(parent);
        return new JsonResult<>(OK,data);
    }
}
